package com.an.java.javaall.java8;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

/**
 * @author antch
 */
public class PredicateTest {
    public static void main(String[] args) {
        List<String> letters = new ArrayList<>(Arrays.asList("A","B","C","D","F","G"));
        Predicate<String> p1 = it -> it.compareTo("C") > 0;
        Predicate<String> p2 = "B"::equals;
        letters.removeIf(p1.negate().or(p2));
        System.out.println(letters);
    }
}
